﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="wfPageTemplateEditor.aspx.cs"
    Inherits="msBsc.WebUi.wfPageTemplateEditor" %>

<!DOCTYPE HTML>
<html>
<head id="Head1" runat="server">
    <title>页面模版编辑</title>
    <link href="/jqPlugin/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet" />
    <script src='/??jqPlugin/kindeditor/kindeditor.js,jqPlugin/kindeditor/lang/zh_CN.js'
        type='text/javascript'></script>
    <!--head fix rgn-->
    <style type="text/css">
          
    </style>
    <script type="text/javascript">
        K = KindEditor;
//        K.DEBUG = true;
        K.basePath = K.options.basePath = '/jqPlugin/kindeditor/';
        K.options.themesPath = K.options.basePath + 'themes/';
        K.options.langPath = K.options.basePath + 'lang/';
        K.options.pluginsPath = K.options.basePath + 'plugins/';
        function getfilequery() {
            return "&ParentId="    + "&FileId=" + ""
                                    + "&RelId=" + ""
                                    + "&rType1=" + "0"
                                    + "&rType2=" + "0";
        };

        var editorContend; 
        function SetEditHtml(_sHtml) {
            scontenthtml = _sHtml;  
        };
        var scontenthtml = '';
        $(window).load(function () {
        
            editorContend = K.create('#txtContentTemplate', {
                allowFileManager: true,
                resizeType: 1,
                allowPreviewEmoticons: true,
                allowImageUpload: false,
                loadStyleMode: false,
                afterCreate: function () { 

                }
            });
            editorContend.fileManagerJson = '/pgajax.axd?F_MANA=1&rType1=0&rType2=0&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                    + "&fType=" + "mana";
            editorContend.uploadJson = '/pgajax.axd?F_UPLOAD=1&blSave=1&COOKATHID=' + (typeof (cookesc) == "undefined" ? "" : cookesc)
                                    + "&fType=" + "mana"
                                    + getfilequery();
            editorContend.sync("txtContentTemplate");
            editorContend.html(scontenthtml);
 
            $.ploadFile("layer", function (script, textStatus) {
                //                layer.load('加载中'); 
            }); 
        });


        function doBoundContent(_shopurl) {
            if (_shopurl != null && _shopurl != undefined && _shopurl != '') {
                jQuery.loadHtml(_shopurl).done(function (_rethtml) {
                    var tpl = HtmlUtil.htmlDecode(_rethtml);
                    scontenthtml = tpl;
                    editorContend && editorContend.html(tpl);
                });
            }
        };
        function doSaveSet() {
            var loadi = layer.load('正在保存中…');
            try {
                function closeload() { layer.close(loadi); }
                var _jsParam = new jsonRow();
                _jsParam.AddCell("ACTION", "doSaveSet");
                //获取数据
                var _jsPost = new jsonRow(); 
                _jsPost.AddCell("TEMPLATE_HTML", editorContend.html());
                _jsPost.AddCell("TEMPLATE_URL", $("#txtTempUrl").val()); 

                ajaxComm(_jsParam, _jsPost, closeload);
            }
            catch (err) {
                layer.close(loadi);
            }
        };
    </script> 
</head>
<body> 
    <form id="wfBseDataSyn" method="post" runat="server">
    <div id="divCondition" style="margin: 0px; border-style: solid; border-width: 1px;
        border-color: #C8D2E0;">
        <textarea name="txtContentTemplate" id="txtContentTemplate" style="width: 100%; height: 600px;
            visibility: hidden;"></textarea>
    </div>
    <div id="bigbox2" style="margin: 0px; margin-top: 12px;">
    <center>
        <input class="btn btn-mini btn-danger" type="button" onclick="javascript:doSaveSet();return false;"
            value="保存(S)" id="btnSave" accesskey="S" /></center>
    </div>
    <input type="hidden" value="" id="txtTempUrl"  runat="server"/>
    </form>
</body> 
</html>
